package com.source.lightfowl.basedata.dao;

import com.source.lightfowl.basedata.entity.BarcodeMachine;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: 谢春泳
 * @Description:
 * @Date: 2020/1/10 11:59
 */
public interface BarcodeMachineDao extends JpaRepository<BarcodeMachine,String>, JpaSpecificationExecutor<BarcodeMachine> {

    @Modifying
    @Transactional
    @Query("delete from BarcodeMachine s where s.id in(?1)")
    void deleteBatch(ArrayList<String> ids);

    @Query("from BarcodeMachine s where s.slaughterHouseId = (?1)")
    List<BarcodeMachine> finBySlaughterHouseId(String id);
}
